//package com.example.springbootvue3;
//
//import cn.itcast.pojo.Country;
//import cn.itcast.pojo.Province;
//import com.example.springbootvue3.controller.hellocontroller;
//import com.example.test.value;
//import org.springframework.boot.SpringApplication;
//import org.springframework.boot.autoconfigure.SpringBootApplication;
//import org.springframework.boot.context.properties.EnableConfigurationProperties;
//import org.springframework.boot.env.YamlPropertySourceLoader;
//import org.springframework.context.ApplicationContext;
//import org.springframework.context.annotation.AnnotationConfigApplicationContext;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.ComponentScan;
//import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
//import org.springframework.core.env.PropertySource;
//import org.springframework.core.io.ClassPathResource;
//
//import java.io.IOException;
//
//@SpringBootApplication
////@EnableConfigurationProperties(value.class)
////@ComponentScan({"com.example.test","com.example.springbootvue3"})
//public class Springbootvue3Application {
//
//    public static void main(String[] args) {
//        ApplicationContext context=SpringApplication.run(Springbootvue3Application.class, args);
//        AnnotationConfigApplicationContext context1=new AnnotationConfigApplicationContext();
//        try {
//            // 加载 application.yml
//            YamlPropertySourceLoader loader = new YamlPropertySourceLoader();
//            PropertySource<?> yamlSource = loader.load(
//                    "application.yml",
//                    new ClassPathResource("application.yml")
//            ).get(0);
//            // 将 YAML 配置添加到上下文环境
//            context1.getEnvironment().getPropertySources().addFirst(yamlSource);
//        } catch (IOException e) {
//            throw new RuntimeException("Failed to load application.yml", e);
//        }
//        context1.register(PropertySourcesPlaceholderConfigurer.class);
//        context1.scan("com.example.test");
//        context1.refresh();
////        for (String beanName : context1.getBeanDefinitionNames()) {
////            System.out.println(beanName);
////        }
//        value a=context1.getBean(value.class);
//        System.out.println(a.getA());
////        Country country=context.getBean(Country.class);
////        System.out.println(country);
////        Province province= (Province) context.getBean("aa");
////        System.out.println(province);
//    }
//}
